function SeleniumRunner(selenium) {

    this.selenium = selenium;

    this.__noSuchMethod__ = interceptSeleniumCall;
    this.describe = describe;
    this.testCases = {};
    this.execute = executeTestCases;
    this.sleep = sleepThread;

    this.getValueOfElement = function(locator) {
        var valueOfElement = this.selenium.getValue(locator);
        return(valueOfElement);
    }



}


function executeTestCases() {

    for(testCase in this.testCases) {
        var testFunction = this.testCases[testCase];
        this.selenium.reportTestCaseStarting(testCase);
        testFunction(this);
        this.selenium.reportTestCaseEnding();
    }

}

function sleepThread(timeInMillis) {
    this.selenium.sleep(timeInMillis);
}

function interceptSeleniumCall(methodName, args) {
    this.selenium.executeSeleniumCommand(methodName, args);    
}

function describe(description) {
    this.selenium.reportStepCompleted("DESCRIBE", description, null, null);
}

// create selenium
var jsSeleniumRunner = new SeleniumRunner(javaSeleniumRunner);


